<%-- 
    Document   : template
    Created on : Mar 24, 2011, 5:16:47 PM
    Author     : Nobal
--%>

<%@page import="com.cardarus.operatingsystem.domain.ReminderType"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.cardarus.operatingsystem.domain.Reminder"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><bean:message key="welcome.title"/></title>
        <link rel="stylesheet" href="${pageContext.servletContext.contextPath}/css/template_css.css" media="screen"
              type="text/css" />
        <html:base/>

        <!-- calendar stylesheet -->
        <link rel="stylesheet" type="text/css" media="all" href="${pageContext.servletContext.contextPath}/js/calendar-win2k-cold-1.css" title="win2k-cold-1" />

        <!-- main calendar program -->
        <script type="text/javascript" src="${pageContext.servletContext.contextPath}/js/calendar.js"></script>

        <!-- language for the calendar -->
        <script type="text/javascript" src="${pageContext.servletContext.contextPath}/js/lang/calendar-en.js"></script>

        <!-- the following script defines the Calendar.setup helper function, which makes
             adding a calendar a matter of 1 or 2 lines of code. -->
        <script type="text/javascript" src="${pageContext.servletContext.contextPath}/js/calendar-setup.js"></script>



    </head>
    <body>
        <div class="container">
            <div class="header">
                <a href="#"><img src="${pageContext.servletContext.contextPath}/img/grlg.png" alt="Insert_logo" name="Insert_logo" width="180" height="90" id="Insert_logo" style="background: #C6D580; display:block;"></a>
            </div><!-- end .header -->
            <div class="content">
                <div align="right"> <html:link page="/views/customerMenu.jsp">Home</html:link>&nbsp;&nbsp;<br/><br/></div>

                <b>Your Name</b>:${user.name} ${user.familyName}<br/>
                <table width="100%" border="0" cellspacing="0" cellpadding="0"
                       class="table-wrapper">
                    <tr>
                        <td>
                            <html:form action="/addReminder" method="post">
                                <table width="60%" border="0">
                                    <tr>
                                        <td width="26%">Reminder date:</td>
                                        <td width="74%"> <html:text styleId="dateString" property="dateString"   size="20"  />
                                            <img alt="cal"  src="${pageContext.servletContext.contextPath}/js/imgcal.gif" id="f_trigger_b" style="cursor: pointer; border: 1px solid red;" title="Date selector"
                                                 onmouseover="this.style.background='red';" onmouseout="this.style.background=''" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="26%">Description:</td>
                                        <td width="74%"> <html:text property="description"  size="60"  />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                                <html:submit value="Add This Reminder" />
                                                &nbsp;</td>
                                    </tr>
                                </table>
                            </html:form>
                            <div style="padding: 15px"> <html:errors />
                            </div>

                        </td>
                    </tr>
                </table>

                <b>My Reminders.</b> Used:${usedReminders}/${totalReminders}
                    <html:form action="/DeleteReminders" method="post">
                        <div style="width:100%;height:200px;overflow:auto;">
                        <table border="1">
                            <thead>
                                <tr>
                                    <th>Select</th>
                                    <th>Created Date</th>
                                    <th>Reminder Date</th>
                                    <th>Description</th>
                                </tr>
                            </thead>
                            <c:forEach var="r" items="${reminders}">
                                <tbody>
                                    <tr>
                                        <td><html:multibox  value="${r.id}" property="selectedRows" /></td>
                                        <td><fmt:formatDate value="${r.creationDate}" pattern="MM/dd/yyyy" /></td>
                                        <td><fmt:formatDate value="${r.reminderDate}" pattern="MM/dd/yyyy" /></td>
                                        <td>${r.description}</td>
                                    </tr>
                                </tbody>
                            </c:forEach>
                        </table>
                 </div>
                       <br/>
                        <input type="submit" value="Delete" name="delete" /> &nbsp;&nbsp;
                        <input type="reset" value="Clear Selection" />


                    </html:form>


                <!-- YOUR CODE HERE -->



            </div><!-- end .content -->
        </div><!-- end .container -->
        <div class="footer">
            <p>Copyright 2011&nbsp;TigerSoft</p>
        </div><!-- end .footer -->
        <script type="text/javascript">
            Calendar.setup({
                inputField     :    "dateString",      // id of the input field
                ifFormat       :    "%m/%d/%Y",       // format of the input field
                button         :    "f_trigger_b",   // trigger for the calendar (button ID)
                step           :    1                // show all years in drop-down boxes (instead of every other year as default)
            });
        </script>

    </body>
</html>